
set(CMAKE_BUILD_TYPE "Debug")

if(UNIX)
    add_definitions( "-Wall -std=c++11" )
endif()

####### Required Libraries ########################
set(EIGEN_INC "" CACHE PATH "Eigen Include Directory") #No default value
set(COIN_UTILS_INC "" CACHE PATH "CoinUtils Include Directory") #No default value
set(BOOST_INC "" CACHE PATH "Boost Lib Include Directory") #No default value
####### Required Libraries ########################

project(Green)

cmake_minimum_required(VERSION 2.8)

add_subdirectory(Parser)
add_subdirectory(LinearProgramming)
add_subdirectory(MatrixCore)

include_directories(.)

include_directories(SYSTEM ${EIGEN_INC})
include_directories(SYSTEM ${COIN_UTILS_INC})
include_directories(SYSTEM ${BOOST_INC})

#TODO Add individual files instead of using regular expression
aux_source_directory(. SRC_LIST)

#TODO CMAKE says this is not recomended way (Using GLOB)
file(GLOB LP_HEADERS "LinearProgramming/*.hpp")

file(GLOB MC_HEADERS "MatrixCore/*.hpp")


#Remove
include_directories(SYSTEM "/usr/local/include")

find_library(CHOLMOD_LIBRARIES cholmod PATHS ${LIB_INSTALL_DIR})
find_library(AMD_LIBRARY amd PATHS ${LIB_INSTALL_DIR})
find_library(COLAMD_LIBRARY colamd PATHS ${LIB_INSTALL_DIR})
find_library(CAMD_LIBRARY camd PATHS ${LIB_INSTALL_DIR})
find_library(CCOLAMD_LIBRARY ccolamd PATHS ${LIB_INSTALL_DIR})

find_library(CHOLMOD_METIS_LIBRARY metis PATHS "/home/satya/ThirdParty/metis-4.0.3")
find_library(SPQR_LIBRARY spqr PATHS ${LIB_INSTALL_DIR})

find_library(SUITESPARSE_C_LIBRARY suitesparseconfig PATHS ${LIB_INSTALL_DIR})

find_library(LAPACK_LIBRARY lapack PATHS ${LIB_INSTALL_DIR})
find_library(BLAS_LIBRARY blas PATHS ${LIB_INSTALL_DIR})
#Remove

#Pastix
include_directories(SYSTEM "/home/satya/ThirdParty/Pastix-5.2.2/include")

find_library(BLAS_LIBRARY blas PATHS ${LIB_INSTALL_DIR})
find_library(HWLOC_LIBRARY hwloc PATHS ${LIB_INSTALL_DIR})
find_library(PTSCOTCH ptscotch PATHS "/home/satya/ThirdParty/Scotch-6.0.0/lib")
find_library(SCOTCH scotch PATHS "/home/satya/ThirdParty/Scotch-6.0.0/lib")
find_library(SCOTCH_ERR scotcherrexit PATHS "/home/satya/ThirdParty/Scotch-6.0.0/lib")
find_library(PTSCOTCH_ERR ptscotcherrexit PATHS "/home/satya/ThirdParty/Scotch-6.0.0/lib")
find_library(PASTIX pastix PATHS "/home/satya/ThirdParty/Pastix-5.2.2/lib")
#Pastix

add_executable(${PROJECT_NAME} ${SRC_LIST} ${LP_HEADERS} ${MC_HEADERS})

#Remove
target_link_libraries(${PROJECT_NAME}
                      ${SPQR_LIBRARY}
                      ${SUITESPARSE_C_LIBRARY}
                      ${CHOLMOD_LIBRARIES}
                      ${AMD_LIBRARY} ${COLAMD_LIBRARY} ${CAMD_LIBRARY} ${CCOLAMD_LIBRARY}
                      ${CHOLMOD_METIS_LIBRARY}
                      ${LAPACK_LIBRARY} ${BLAS_LIBRARY}
                      gfortran  )
#Remove

target_link_libraries(${PROJECT_NAME} parser )

target_link_libraries(${PROJECT_NAME}
                      ${PASTIX} ${PTSCOTCH} ${SCOTCH} ${SCOTCH_ERR} m rt  pthread
                      ${HWLOC_LIBRARY}
                      ${BLAS_LIBRARY} gfortran    )

